﻿<Window x:Class="TorchView.SharedStashEditor.Views.AddItemView" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:helper="clr-namespace:TorchView.SharedStashEditor.Helpers"
        Title="Add Item:" 
        WindowStartupLocation="CenterScreen" 
        Style="{StaticResource DialogWindowStyle}">
    
    <Window.Resources>
        <helper:ItemCategoryConverter x:Key="ItemCategoryConverter" />
        <helper:ItemIdConverter x:Key="ItemIdConverter" />
        <helper:ItemEffectConverter x:Key="ItemEffectConverter" />
    </Window.Resources>
    
    
    <Grid Margin="7">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,7" Height ="200">
            <ListBox Width="200" Name="ItemCategory" ItemsSource="{Binding Items.Categories}" IsSynchronizedWithCurrentItem="True"></ListBox>
            <ListBox Width="200" Name="ItemList" ItemsSource="{Binding ElementName=ItemCategory,Path=SelectedItem, Converter={StaticResource ItemCategoryConverter}, Mode=OneWay}"></ListBox>
            <ListBox Width="200" Name="ItemEffect" ItemsSource="{Binding ElementName=ItemList,Path=SelectedItem, Converter={StaticResource ItemEffectConverter}, Mode=OneWay}"></ListBox>
        </StackPanel>
        <TextBox Grid.Row="1" Grid.ColumnSpan="2" MinWidth="300" Margin="0,7" Text="{Binding ElementName=ItemList,Path=SelectedItem, Converter={StaticResource ItemIdConverter}, Mode=OneWay}" Background="{StaticResource BackgroundBrush}" Foreground="{StaticResource HighlightedTextBrush}" BorderBrush="{StaticResource BorderBrush}" TextChanged="TextBox_TextChanged" />
        <Button Grid.Row="2" HorizontalAlignment="Right" Content="OK" IsDefault="True" Command="{Binding OKCommand}" Margin="7,0" />
        <Button Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Content="Cancel" IsCancel="True" />
    </Grid>
</Window>

